#!/bin/bash
#date 2022/2/8
#mail it-arch
#############
echo "##########################################"
echo "Auto Install Oracle.                    ##"
echo "Press Ctrl + C to cancel                ##"
echo "Any key to continue                     ##"
echo "##########################################"
read -n 1
yum groupinstall -y "X Window System"
yum -y install binutils compat-libstdc++-33  elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc glibc-common   glibc-headers ksh libaio libaio libaio-devel  libgcc libgcc libstdc++ libstdc++ libstdc++-devel make sysstat
mkswap /root/swapfile
sleep 3
swapon /root/swapfile
echo "/root/swapfile swap swap defaults 0 0" >>/etc/fstab
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
echo "oracle" | passwd --stdin oracle
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app
cat >> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1200000000
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
EOF
systctl -p
cat >> /etc/security/limits.conf << EOF
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   10240
EOF

